#ifndef _bsp_map_chris_10_39_jun_15_header_guard_
#define _bsp_map_chris_10_39_jun_15_header_guard_

#include "config.h"
#include <string>
#include <Eigen/Core>
#include <fstream>
#include "Polygon3D.h"
#include <stdexcept>
#include <boost/foreach.hpp>
#include "Brush.h"
#include <typeinfo>

namespace libPortal
{
  namespace DoomIII
  {
    class PORTALAPI DoomIIIPlane : public BSPPlane
    {
    public:
      DoomIIIPlane(Eigen::Hyperplane<double, 3> planeEquation);
      Eigen::Matrix3d texMat;
    };

    class PORTALAPI DoomIIIBrush3D : public BSPBrush3D
    {
    public:
      DoomIIIBrush3D() : BSPBrush3D() {}
    };
    
    class PORTALAPI DoomIIIMap
    {
    public:
      DoomIIIMap();
      ~DoomIIIMap();
      DoomIIIMap(const DoomIIIMap &other);

      DoomIIIMap& operator=(const DoomIIIMap &rhs);

      bool load(const std::string &filename);

      double mapSize() const;

      std::vector<DoomIIIBrush3D>::const_iterator begin() const;
      std::vector<DoomIIIBrush3D>::const_iterator end() const;
    private:
      std::vector<DoomIIIBrush3D> brushes;
    };
    void computeTexCoords(DoomIIIPlane &p);
  }
}

#endif
